Ext.ux.Button= Ext.extend(Ext.Button , {
	initComponent : function() {
		var _this=this;
		var config = {				
			handler:eval('this.'+_this.actionType)
		};
				
		Ext.apply(this, config);
		Ext.apply(this.initialConfig, config);
		Ext.ux.Button.superclass.initComponent.apply(this, arguments);		
	}
	,
	close:function(){
		this.owner.close();
	},
	save:function(){
		var _this=this;
		if(this.form.getForm().isValid()){
			var postdata = _this.owner.getPostdata();
			if(typeof postdata == 'object' && postdata.failure){
				Ext.Msg.alert('提示',postdata.msg);
				return false;
			}else{
				 AjaxDelegate(_this.action, _this.callback, _this.postdata,'none','操作成功');	
			}
		}
	}
	,
	saveAndclose:function(){
		AjaxDelegate(this.action, this.callback, this.postdata,true);	
		this.owner.close();
	},
	
	reset:function(){		
		this.owner.form.reset();
	}
	,
	
	confirm:function(){		
		var _this=this;
		if(this.form.getForm().isValid()){
			Ext.Msg.show({
				title : '提示',
				msg : '您确实要操作吗?',
				buttons : {yes:'是', no:'否'},
				fn : function(btn, text){  
                     	if (btn == 'yes'){  
                     		AjaxDelegate(_this.action, _this.callback, _this.postdata,'none','操作成功');
                        } 
					}
			})
		}
//		this.owner.form.reset();
	}
});

Ext.reg('comButton',Ext.ux.Button);




